<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * Evento filter form base class.
 *
 * @package    filters
 * @subpackage Evento *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseEventoFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cd_tipo_evento'   => new sfWidgetFormDoctrineChoice(array('model' => 'TipoEvento', 'add_empty' => true)),
      'cd_camara'        => new sfWidgetFormDoctrineChoice(array('model' => 'Camara', 'add_empty' => true)),
      'cd_cidade'        => new sfWidgetFormDoctrineChoice(array('model' => 'Cidade', 'add_empty' => true)),
      'nr_evento'        => new sfWidgetFormFilterInput(),
      'dt_hr_inicio'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'dt_hr_termino'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'de_endereco'      => new sfWidgetFormFilterInput(),
      'ic_confirmado'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'extrato'          => new sfWidgetFormFilterInput(),
      'pauta'            => new sfWidgetFormFilterInput(),
      'pauta_enviada_em' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'ata'              => new sfWidgetFormFilterInput(),
      'ata_enviada_em'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'deleted'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'cd_tipo_evento'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'TipoEvento', 'column' => 'cd_tipo_evento')),
      'cd_camara'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Camara', 'column' => 'cd_camara')),
      'cd_cidade'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Cidade', 'column' => 'cd_cidade')),
      'nr_evento'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'dt_hr_inicio'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'dt_hr_termino'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'de_endereco'      => new sfValidatorPass(array('required' => false)),
      'ic_confirmado'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'extrato'          => new sfValidatorPass(array('required' => false)),
      'pauta'            => new sfValidatorPass(array('required' => false)),
      'pauta_enviada_em' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'ata'              => new sfValidatorPass(array('required' => false)),
      'ata_enviada_em'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'deleted'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('evento_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Evento';
  }

  public function getFields()
  {
    return array(
      'cd_evento'        => 'Number',
      'cd_tipo_evento'   => 'ForeignKey',
      'cd_camara'        => 'ForeignKey',
      'cd_cidade'        => 'ForeignKey',
      'nr_evento'        => 'Number',
      'dt_hr_inicio'     => 'Date',
      'dt_hr_termino'    => 'Date',
      'de_endereco'      => 'Text',
      'ic_confirmado'    => 'Boolean',
      'extrato'          => 'Text',
      'pauta'            => 'Text',
      'pauta_enviada_em' => 'Date',
      'ata'              => 'Text',
      'ata_enviada_em'   => 'Date',
      'deleted'          => 'Boolean',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
    );
  }
}